<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/pages/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>index</title>
<!-- 首页布局样式文件 -->
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/index.css">
<!-- end -->
<link rel="stylesheet" type="text/css"
	href="<%=path%>/js/js_plug/easyui/themes/pepper-grinder/easyui.css"
	id="swicth-style">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/js/js_plug/easyui/themes/icon.css">
<script src="<%=path%>/js/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript"
	src="<%=path%>/js/js_plug/easyui/jquery.easyui.min.js"></script>


</head>
<body>

</body>
<script language="javascript">
	var treeDataOld = [ "a", "b", "c", "d", "e", "f", "g" ]; //数组A  

	var treeDataNew = [ "a", "b", "c", "d", "e", "f", "g" ];//数组B  

	/**
	*返回arr1在arr2中不存在的元素
	*/
	function getDiffData(arr1, arr2){
		
		var temp = []; //临时数组1  
		var temparray = [];//临时数组2  
	
		for ( var i = 0; i < arr2.length; i++) {
			temp[arr2[i]] = true;//巧妙地方：把数组B的值当成临时数组1的键并赋值为真  
		};
	
		for ( var i = 0; i < arr1.length; i++) {
			if (!temp[arr1[i]]) {
				temparray.push(arr1[i]);//巧妙地方：同时把数组A的值当成临时数组1的键并判断是否为真，如果不为真说明没重复，就合并到一个新数组里，这样就可以得到一个全新并无重复的数组  
			}
		};
		
		return temparray.join(",");
	}

	var delData = getDiffData(treeDataOld, treeDataNew);
	var addData = getDiffData(treeDataNew, treeDataOld);
	
	alert(delData + " : " + addData);
	
</script>
</html>